<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <ul>
      
    </ul>
  </div>
  <script src="./vue.js"></script>
  <script src="./axios.js"></script>
  <script>
    axios.defaults.baseURL="https://api.it120.cc/conner";
    axios.defaults.headers['a'] = 'dwfgthyjuil';
    const vm = new Vue({
      el: '#app',
      data: {
        items: [],
        cates:[]
      },
      methods: {
        fetchCates(){
          // get请求
          axios({
            url: '/shop/goods/category/all',
            method: 'get',
            params: {
              a: 10,
              b: 20
            }
          }).then(res  => {
            console.log(res, 'get');
          })
        },
        fetchItems(){
          // post请求
          axios({
            url: '/shop/goods/list/v2',
            method: 'post',
            data: {
              page: 1,
              pageSize: 10
            }
          }).then(res => {
            console.log(res, 'post');
          })
        }
      },
      created(){
        this.fetchItems();
        this.fetchCates();
      }
    })
  </script>
</body>
</html>

